﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aim2 {
    class FloatTransition {
        float elapsed;
        float targetElapsed;
        float targetValue;
        float initialValue;
        public float CurrentValue {
            get {
                return (elapsed / targetElapsed) * (targetValue - initialValue) + initialValue;
            }
        }

        public FloatTransition(float targetElapsed, float targetValue, float initialValue) {
            this.targetElapsed = targetElapsed;
            this.targetValue = targetValue;
            this.initialValue = initialValue;
        }
        
        public void Update(float e) {
            elapsed += e;
            if (elapsed > targetElapsed)
                elapsed = targetElapsed;
            float percentage = elapsed / targetElapsed;
        }

        public bool IsOver() {
            return elapsed == targetElapsed;
        }

    }
}
